﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Yun.IM.Response;
using Yun.Interface;
using Yun.Util;

namespace Yun.IM.Request
{
    /// <summary>
    /// 获取阿里云推送信息列表
    /// yun.im.aliyun.push.list
    /// </summary>
    public class GetAliyunPushRecordsRequest : ITopRequest<GetAliyunPushRecordsResponse>
    {
        /// <summary>
        /// 用户ID
        /// </summary>
        public long? UserId { get; set; }

        /// <summary>
        /// 设备号
        /// </summary>
        public string DeviceId { get; set; }

        /// <summary>
        /// 查询应用的appKey
        /// </summary>
        public long? AliyunAppKey { get; set; }

        /// <summary>
        /// 查询消息的类型, MESSAGE：表示消息，NOTICE：表示通知
        /// </summary>
        public string PushType { get; set; }

        /// <summary>
        /// 查询的起始时间
        /// </summary>
        public string StartTime { get; set; }

        /// <summary>
        /// 查询的结束时间
        /// </summary>
        public string EndTime { get; set; }

        /// <summary>
        /// 推送记录的当前页数, 默认为1
        /// </summary>        
        public int PageNum { get; set; } = 1;

        /// <summary>
        /// 每页的条目，默认值为20, 最大为100
        /// </summary>
        public int PageSize { get; set; } = 1;


        /// <summary>
        /// 推送任务id
        /// </summary>
        public string MessageId { get; set; }


        public string GetApiName()
        {
            return "yun.im.aliyun.push.list";
        }
        public void Validate()
        {
            RequestValidator.ValidateMaxValue("pagesize", PageSize, 1000);
        }

        public IDictionary<string, string> GetParameters()
        {
            var parameters = new YunDictionary
            {
                {"pagenum", PageNum},
                {"pagesize", PageSize},
                {"userid", UserId},
                {"aliyunappkey", AliyunAppKey},
                {"deviceid", DeviceId},
                {"starttime", StartTime},
                {"endtime", EndTime},
                {"pushtype", PushType},
                {"messageid", MessageId}
            };

            return parameters;
        }

    }
}
